Skip to content

fix: add logging to silent catch blocks#24331

Closed
alfredocristofano wants to merge 1 commit into
anomalyco:devfrom
alfredocristofano:fix/catch-blocks-logging
Closed

fix: add logging to silent catch blocks#24331
alfredocristofano wants to merge 1 commit into
anomalyco:devfrom
alfredocristofano:fix/catch-blocks-logging

Conversation

@alfredocristofano
Copy link
Copy Markdown

@alfredocristofano alfredocristofano commented Apr 25, 2026

Issue for this PR

Closes #24327

Type of change

  • Bug fix

What does this PR do?

Adds logging to selected silent catch blocks where failures were being swallowed without any signal:

  • auth content parsing
  • MCP child process cleanup
  • provider error body parsing
  • PTY teardown
  • mDNS cleanup
  • session error handling
  • JSON/stringify and filesystem helper paths

It also replaces one catch (e: any) in session/llm.ts with unknown handling.

How did you verify your code works?

  • Rebased onto current origin/dev
  • Checked the diff is limited to 10 files and no longer includes unrelated import/barrel changes
  • git diff --check origin/dev..HEAD

I tried cd packages/opencode && bun typecheck inside the temporary worktree, but that worktree does not have the repo dependencies installed, so TypeScript reported dependency resolution errors before checking this patch.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one related PR:

Potential Related PR:

However, since PR #24331 is the current PR and it appears to have broader scope (across 10 production files with ~30 catch blocks vs. cleanup operations), this is likely a separate, complementary effort rather than a true duplicate.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Add logging to selected silent catch blocks in auth, MCP cleanup, provider error parsing, PTY teardown, mDNS cleanup, session error handling, and utility helpers.

Replace one catch (e: any) with unknown-safe handling in session/llm.ts.

Closes anomalyco#24327
@alfredocristofano alfredocristofano force-pushed the fix/catch-blocks-logging branch from eb8bd1e to 44a01d5 Compare April 27, 2026 18:04
@alfredocristofano alfredocristofano changed the title fix: add logging to silent catch blocks across core modules fix: add logging to silent catch blocks Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ~30 catch blocks silently swallow errors across core modules

1 participant